<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <!--信息管理页面-->
    <title>公交管理系统</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/css/layuimini.css?v=2.0.4.2}" media="all">
    <link rel="stylesheet" th:href="@{/css/themes/default.css}" media="all">
    <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
    <style>
        body{
            padding: 20px;
        }
    </style>
</head>
<body>
<form class="layui-form" action="" th:object="${info}">
    <input type="hidden" th:field="*{id}">
    <div class="layui-form-item">
        <label class="layui-form-label">联系电话</label>
        <div class="layui-input-block">
            <input type="text" th:field="*{contactNumber}" required="required"  lay-verify="required" placeholder="请输入联系电话" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">公司名称</label>
        <div class="layui-input-block">
            <input type="text" th:field="*{corporateName}" required="required"  lay-verify="required" placeholder="请输入公司名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">管理者名字</label>
        <div class="layui-input-block">
            <input type="text" th:field="*{adminName}" required="required"  lay-verify="required" placeholder="请输入管理者名字" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">管理者QQ</label>
        <div class="layui-input-block">
            <input type="text" th:field="*{qq}" required="required"  lay-verify="required" placeholder="请输入管理者QQ" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">管理者微信</label>
        <div class="layui-input-block">
            <input type="text" th:field="*{vx}" required="required"  lay-verify="required" placeholder="请输入管理者微信" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-block">
            <input type="text" th:field="*{address}" required="required"  lay-verify="required" placeholder="请输入地址" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">网站介绍信息</label>
        <div class="layui-input-block">
            <textarea name="message" th:field="*{content}" required lay-verify="required" placeholder="请输入网站介绍信息" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button id="btn-submit" class="layui-btn" lay-submit lay-filter="btn-submit-filter">立即提交</button>
        </div>
    </div>
</form>
    <script th:src="@{/layui/layui.js}" charset="utf-8"></script>
    <script th:inline="javascript">
        layui.use(['laydate','table','form'], function(){
            var laydate = layui.laydate;
            var table = layui.table;
            var form = layui.form;
            var $ = layui.$;

            laydate.render({
                elem: '[name="birthday"]' //指定元素
            });
            // 表单提交
            form.on('submit(btn-submit-filter)', function(data){
                $("#btn-submit").attr("disabled","disabled").addClass("layui-btn-disabled");
                // 异步请求提交数据
                var url = "/info/updateInfo";
                $.post(url,data.field,function (response) {
                    if(response.code == '200'){
                        // 成功提示
                        layer.msg(response.message, {
                            icon: 1,
                            time: 1000 //2秒关闭（如果不配置，默认是3秒）
                        }, function(){
                            // 刷新表格
                            // parent.refreshTable();
                            // // 关闭窗口
                            // var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            // parent.layer.close(index); //再执行关闭
                        });
                    }else{
                        $("#btn-submit").removeAttr("disabled","disabled").removeClass("layui-btn-disabled");
                        // 失败则提示错误信息，窗口不关闭
                        layer.alert(response.message, {
                            icon: 2,
                            anim: 6,
                            title: "操作失败"
                        });
                    }
                });
                return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });
        });
    </script>
</body>
</html>
